﻿using System.Text.RegularExpressions;

namespace Magellan.Routing
{
    public class LiteralSegmentRecognizer : RegexBasedSegmentRecognizer
    {
        public LiteralSegmentRecognizer()
            : base(new Regex("^[A-Z0-9\\-]+$", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline))
        {
        }

        protected override Segment Build(Match match, RouteValueDictionary defaults, RouteValueDictionary constraints)
        {
            return new LiteralSegment(match.Value);
        }
    }
}